﻿<%--
 *  File:    BunchnoUpload.jsp	
 *  @Author: jackwang
 *  Date:    2012/05/28
 *
 *  Copyright (C) 2000 - 2008 Oval Technologies, Inc.
 *  All rights reserved. 
 *
 *  This software is the confidential and proprietary information of Oval 
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>

<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/oval-tag.tld" prefix="oval"%>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom"%>

<%
  //init param
  Category cat = Category.getInstance("jsp.BunchnoUpload");
  String privilegeCode = "A0900";
  String strModuleName = "TDR";
  String contextPath = request.getContextPath();
%>
<%@ include file="/inc/CommonHeader.inc"%>
<%@ include file="/inc/OvalLocationDefault.inc"%>
<%@ include file="/inc/CatchError.inc"%>
<%@ include file="/inc/SumDiv.inc"%>
<%@ include file="/rpt/ReportURL.inc"%>
<html>
<head>
<title>BunchnoUpload</title>
<PageFlow:CheckPageFlow pageName="p_uploadtmpbatchnodata" />

<%
  Vector totalsummary = (Vector)pageContext.getAttribute("totalsummary");
  if(totalsummary == null) totalsummary = new Vector();
  
  HashMap Errorinformation = (HashMap)session.getAttribute("errorinformation");
  if(Errorinformation == null) Errorinformation = new HashMap();
  
  HashMap UserInfo = (HashMap)session.getAttribute("userinfo");
  if(UserInfo == null) UserInfo = new HashMap();
%>
<link rel="stylesheet"
	href="<%=contextPath%>/css/<%= strLanguageCode %>/main.css"
	type="text/css">
<script language="JavaScript" src="<%=contextPath%>/css/cn/script.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/ScriptLib.js"></script>
<script language="JavaScript"
	src="<%=contextPath%>/js/SummaryDivision.js"></script>

<script language="JavaScript"><!--
<%--  put your custom script here   --%>
function page_summary(actionvalue,orderbyname)
{
  var editform = summaryPrepare(cform,actionvalue,orderbyname);
  if(!editform) return;
  editform.action = "BunchnoUpload.jsp?<%= OvalTools.randomURL() %>";
  editform.target = "_self";
  isRunning = true;
  editform.submit();
}

function page_check(){
    document.getElementById("goingid").style.display = "block" ;
    document.getElementById("information").style.display = "none" ;
    document.getElementById("scheck").style.display="none";
    cform.actionname.value = "check";
    cform.target = "_self";
    isRunning = true;
    cform.submit();
}

function page_confirm(){
	cform.actionname.value = "confirm";
    cform.target = "_self";
    isRunning = true;
    cform.submit();
}

function page_giveup(){
	var flag1 = confirm("<%= message.getMessageDesc("SURE_GIVE_UP")%>");
	if(!flag1){
		return;
	}
	cform.actionname.value = "giveup";
    cform.target = "_self";
    isRunning = true;
    cform.submit();
}	

function page_operate(operand)
{
   /* var information=document.getElementById("information");
    //information.style.display='block';
    alert(cform.informationcode.value);
    if(cform.informationcode.value == 1){
     information.style.background="red";
     //information.innerHTNL="<font color='red'><font>";
     alert(information.innerHTNL);
    }*/
 
	if(cform.filename.value == "" || cform.filename.value == null){
		return false;
	}
		  if (operand=="upload")
		  {
		    cform.encoding="multipart/form-data";
		    cform.actionname.value = "upload";
		    cform.target = "_self";
		    cform.submit();
		  }
	  
}

function page_excel(){
	var id = <%=UserInfo.get("userid")%>;
	<%
	int uploadfileid=0;
	if(totalsummary.size() > 0){
	   uploadfileid=((Integer)((HashMap)totalsummary.get(0)).get("uploadfileid")).intValue();
	}
	%>
	var uploadfileid=<%=uploadfileid%>;
	//alert("<%= reportURL %>/servlet/ExcecuteReport/BunchnoUploadComments.sox?__folder=/ovalreport&userid="+id+"&uploadfileid="+uploadfileid);
	window.open("<%= reportURL %>/servlet/ExcecuteReport/BunchnoUploadComments.sox?__folder=/ovalreport&userid="+id+"&uploadfileid="+uploadfileid);	
 }
 
 function page_success(){
  <%
	  String issuccess=null;
      issuccess =(String)session.getAttribute("issuccess");
	  %>
				<% if(("Y").equals(issuccess)){
					session.removeAttribute("issuccess");%>
				 alert("上载成功");
				<%}
				if(("N").equals(issuccess)){
					session.removeAttribute("issuccess");%>
					//alert("上载失败");
				<%}
				%>
				
				<% 
				String issubmit=null;
				String submit=null;
				issubmit =(String)session.getAttribute("issubmit");
				submit =(String)session.getAttribute("submit");
				if(("Y").equals(issubmit) && ("Y").equals(submit)){ 
				%>
				alert("检查通过，请提交!");
				<%
				session.removeAttribute("submit");
				}%>
	document.getElementById("goingid").style.display = "none" ;
	//document.getElementById("check").removeAttr("disabled");
 }
--></script>


</head>

<body style="overflow: auto;" onload="page_success();">
<form name="cform" method="post" action="<%=contextPath%>/Dispatcher"><input
	type="hidden" name="pagename" value=p_uploadtmpbatchnodata> <input
	type="hidden" name="actionname"> <input type="hidden" name="name"> <input
	type="hidden" name="isfirst" value="N"> <input type="hidden"
	name="issubmit" value="N"> <input type="hidden" name="type"> <input
	type="hidden" name="sheetname" value="zyltmpbatchnoinfo"> <input
	type="hidden" name="flag" value="batchnodata"> <input type="hidden"
	name="userid" value="<%= (Integer)UserInfo.get("userid") %>"> <input
	type="hidden" name="__header__Content-disposition" id="outname"
	value="attachment;filename=OrgCollateMasterData.xls" /> <custom:hidden
	scope="session" name="userinfo" property="userid"></custom:hidden>
    <input type="hidden" name="batchnoype" value="2"> 
 <%--  page location   --%>

<%@ include file="/inc/PageLocation.inc"%>
<table width="100%" cellspacing="0" border="0" cellpadding="0">
	<tr>
		<%--  search criteria  --%>
	</tr>
	<tr>
		<td>
		<table width="100%" border="0" cellspacing="0">
			<tr>
				<td><%= label.getLabelName("L_Path") %><%= label.getLabelName("L_Colon") %>
				<input type="file" name="filename" size="30">
				&nbsp;&nbsp;&nbsp;&nbsp; <a onClick="page_operate('upload')"><custom:button
					type="1" label="L_Finish" imgsrc="finish.gif" border="0"
					style="width:60" /></a></td>
			</tr>
			<tr>
				<td><input type="hidden" name="informationcode"
					value="<%=(String)Errorinformation.get("informationcode")%>">
				<div id="information"><%
				  String informationcode =(String)(Errorinformation.get("informationcode"));
				  if(informationcode == null) {informationcode ="0";}
				  int icode=Integer.parseInt(informationcode);
				  if(icode == 1){
					  Errorinformation.remove("informationcode");
				  %> <font color="red" style="font-weight: bold;">同一文件名的文件已经上载过,不能重复上载！</font>
				<%} 
				  
				  	  if(icode == 2){
					  Errorinformation.remove("informationcode");
				  %> <font color="red" style="font-weight: bold;">当前用户还有数据待处理，请先处理完毕再上载!</font>
				<%} 
				  %></div>
				<div id="goingid" class="RoundedCorner"
					style="width:250px;height:40px;float:left;display:none;"><b
					class="rtop"><b class="r1"></b><b class="r2"></b><b class="r3"></b><b
					class="r4"></b></b> <font color="red" style="font-weight: bold;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;正在处理中，请耐心等候...</font><br>
				<b class="rbottom"><b class="r4"></b><b class="r3"></b><b class="r2"></b><b
					class="r1"></b></b></div>
				</td>
			</tr>
		</table>
		</td>
	</tr>
	<tr>
		<td>
		<center>
		<div style="overflow:auto;width:1450;height:400">
		<table width="100%" border="1" cellpadding="0"
			bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0"
			align="center">
			<tr class="deepblue-left">

				<!--<td class="title_center" width="7.6%">进出库级别</td>
				-->
				<td class="title_center" width="7.6%">流向日期</td>
				<td class="title_center" width="7.6%">出货方</td>
				<td class="title_center" width="7.6%">进货方</td>
				<td class="title_center" width="7.6%">产品</td>
				<td class="title_center" width="7.6%">包装类型</td>
				<td class="title_center" width="7.6%">实际盒数</td>
				<td class="title_center" width="7.6%">批号</td>
				<td class="title_center" width="7.6%">密码</td>
				<td class="title_center" width="7.6%">监管码</td>
				<td class="title_center" width="7.6%">拼装类型</td>
				<td class="title_center"><%= label.getLabelName("L_ErrorMsg") %></td>
			</tr>
			<%
	int i=0;
	String strClassType="";
	int checkflag = 0;
%>
			<%--  the old detail lines  --%>
			<span id="olddetail"> <logic:iterate id="onerow"
				collection="<%= totalsummary %>" indexId="idx" scope="page">
				<%
	if(i%2 == 1)
	  {
	    strClassType = "td-listrom";
	  }else{                    
	    strClassType = "none";
	  }
	  i++;
	  
	  HashMap row = (HashMap)pageContext.getAttribute("onerow");
	if(row.get("errormessage") != null){
		strClassType = "need";
		
	}
	checkflag = totalsummary.size();
%>
				<% 
String tcomments=null;
tcomments=(String)row.get("comments");

if(tcomments == null) { %>
				<tr onMouseOver="this.className='tr-over'"
					onMouseOut="this.className='<%=strClassType%>'"
					class="<%=strClassType%>">
					<% } else {%>
				<tr onMouseOver="this.className='tr-over'"
					onMouseOut="this.className='<%=strClassType%>'"
					class="<%=strClassType%>" style="border-color: red;">
					<%} %>
					<!--<td class="title_center"><custom:write property="batchnoype"
						name="onerow" nbsp="true" /></td>
					-->
					<td class="title_center"><custom:write property="docdate"
						name="onerow" nbsp="true" /></td>
					<td class="title_center"><custom:write property="shipfromcode"
						name="onerow" nbsp="true" /></td>
					<td class="title_center"><custom:write property="shiptocode"
						name="onerow" nbsp="true" /></td>
					<td class="title_center"><custom:write property="productcode"
						name="onerow" nbsp="true" /></td>
					<td class="title_center"><custom:write property="datatype"
						name="onerow" nbsp="true" /></td>
					<td class="title_center"><custom:write property="qty" name="onerow"
						nbsp="true" /></td>
					<td class="title_center"><custom:write property="batchno"
						name="onerow" nbsp="true" /></td>
					<td class="title_center"><custom:write property="datacode"
						name="onerow" nbsp="true" /></td>
					<td class="title_center"><custom:write property="itmecode"
						name="onerow" nbsp="true" /></td>
					<td class="title_center"><custom:write property="assemblytype"
						name="onerow" nbsp="true" /></td>
					<td class="title_center"><custom:write property="comments"
						name="onerow" nbsp="true" /></td>
				</tr>

			</logic:iterate> </span>
			<tr>
				<td colspan="37" align="left"><%= label.getLabelName("L_TotalData") + label.getLabelName("L_Colon") %><custom:write
					property="count" name="count" nbsp="true" /></td>
			</tr>

			<%@ include file="/inc/SummaryAction.inc"%>
		</table>
		</div>
		<div id="scheck">
		<table width="100%" cellspacing="0" cellpadding="0">
			<tr>
				<td class="summary_top"></td>
			</tr>
			<tr>

				<td class="td_center"><%if (totalsummary.size() > 0){ 
					if(checkflag == 0){
				%> <a onClick="page_check();"><custom:button type="1"
					label="L_CheckContent" imgsrc="new.gif" border="0" style="width:60" /></a>
				<%}else if( checkflag >0){ %><a onClick="javascript:page_check();"><custom:button
					type="1" label="L_CheckResult" imgsrc="new.gif" border="0"
					style="width:60" /></a> <a onClick="javascript:page_giveup();"><custom:button
					type="1" label="L_GiveUp" imgsrc="new.gif" border="0"
					style="width:60" /></a> <% if(("Y").equals(issubmit)){ 
				%> <a onClick="javascript:page_confirm();"><custom:button type="1"
					label="L_Submit" imgsrc="new.gif" border="0" style="width:60" /></a>
				<%} 
				%> <a onClick="javascript:page_excel();"><custom:button type="1"
					label="L_ExcelE" imgsrc="new.gif" border="0" style="width:60" /></a>
				<%}else if(checkflag < 0){ %> <a onClick="javascript:page_excel();"><custom:button
					type="1" label="L_Execcd" imgsrc="new.gif" border="0"
					style="width:60" /></a> <a onClick="javascript:page_giveup();"><custom:button
					type="1" label="L_GiveUp" imgsrc="new.gif" border="0"
					style="width:60" /></a> <%}}%></td>
			</tr>
		</table>
		</div>
	</tr>
</table>
</form>
</body>
</html>
